//
//  TKmainShowTableViewCell.m
//  Ticket
//
//  Created by 小禹宝宝 on 2017/10/20.
//  Copyright © 2017年 cy55. All rights reserved.
//

#import "TKmainShowTableViewCell.h"
@interface TKmainShowTableViewCell ()
@property (weak, nonatomic) IBOutlet UIImageView *goodsImageView;
@property (weak, nonatomic) IBOutlet UILabel *priceLabel;
@property (weak, nonatomic) IBOutlet UILabel *descLabel;
@property (weak, nonatomic) IBOutlet UILabel *authorLabel;
@property (weak, nonatomic) IBOutlet UIImageView *iconImageView;
@property (weak, nonatomic) IBOutlet UILabel *contentLabel;
@property (weak, nonatomic) IBOutlet UILabel *tapCountLabel;

@end
@implementation TKmainShowTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    self.authorLabel.textColor = [BLColorConfig textColor];
    self.contentLabel.textColor = [UIColor whiteColor];
    self.contentLabel.backgroundColor = [UIColor jc_colorWithHexString:@"121212" alpha:0.3];
    [self.contentView bringSubviewToFront:self.contentLabel];
    self.descLabel.textColor = [BLColorConfig darkGrayColor];
    self.priceLabel.textColor = [BLColorConfig mainColor];
    self.iconImageView.layer.masksToBounds = YES;
    self.iconImageView.layer.borderWidth = 2.0f;
    self.iconImageView.layer.borderColor = [[UIColor jc_colorWithHexString:@"eeeeee"] CGColor];
    self.iconImageView.layer.cornerRadius = self.iconImageView.bounds.size.width/2;
    self.iconImageView.contentMode = UIViewContentModeScaleAspectFill;
    self.goodsImageView.contentMode = UIViewContentModeScaleAspectFill;
    self.goodsImageView.layer.masksToBounds = YES;

}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

-(void)setModel:(TKGoodsItem *)model {
    _model = model;
    [self.goodsImageView sd_setImageWithURL:[NSURL URLWithString:model.headimg] placeholderImage:[UIImage imageNamed:@"weibo02"]];
    NSString *sellStr;
    if (model.sell_type == 1) {
        sellStr = @"一口价";
        self.priceLabel.text = [NSString stringWithFormat:@"%@  ¥ %@",sellStr,model.price];
    }
    if(model.sell_type == 2) {
        sellStr = @"拍卖";
        NSString *price;
        
        if ([model.top_price floatValue] > 0) {
            price = model.top_price;
        } else {
            price = model.min_price;
        }
        self.priceLabel.text = [NSString stringWithFormat:@"%@  ¥ %@",sellStr,price];
    }
//    self.descLabel.text = model.intro;
    self.authorLabel.text = model.user.user_name;
    [self.iconImageView sd_setImageWithURL:[NSURL URLWithString:model.user.user_portrait] placeholderImage:[UIImage imageNamed:@"icon_placeholder"]];
    self.contentLabel.text = model.intro;
    
}
@end
